/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package yaamp2;
import static java.lang.Math.*;
/**
 *
 * @author xuwang
 */
public class ToolBox {
    private static double earthradius = 6372.797; //km

    public static double DistanceOfTwoPoints(double w1, double j1, double w2, double j2) {
        w1 = w1 * PI / 180;
        j1 = j1 * PI / 180;
        w2 = w2 * PI / 180;
        j2 = j2 * PI / 180;
        double alpha = acos(cos(w1) * cos(w2) * cos(j1 - j2) + sin(w1) * sin(w2));
        return (alpha * earthradius);

    }

}
